import cv2
import matplotlib.pyplot as plt
from 显示图像 import my_img_show

img =cv2.imread("new.jpg")
img_rbg= cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
my_img_show(img_rbg)                                                                                                                                                                        
border_params =(50, 50, 50, 50)
img_replicate =cv2.copyMakeBorder(img_rbg,*border_params,borderType=cv2.BORDER_REPLICATE)
img_reflect =cv2.copyMakeBorder(img_rbg,*border_params,borderType=cv2.BORDER_REFLECT)
img_reflect101 =cv2.copyMakeBorder(img_rbg,*border_params,borderType=cv2.BORDER_REFLECT101)
img_wrap =cv2.copyMakeBorder(img_rbg,*border_params,borderType=cv2.BORDER_WRAP)
img_constant =cv2.copyMakeBorder(img_rbg,*border_params,borderType=cv2.BORDER_CONSTANT)
plt.subplot(231),plt.imshow(img),plt.title('ORIGINAL')
plt.subplot(232),plt.imshow(img_replicate),plt.title('REPLICATE')
plt.subplot(233),plt.imshow(img_reflect),plt.title('REPLECT')
plt.subplot(234),plt.imshow(img_reflect101),plt.title('RELECT101')
plt.subplot(235),plt.imshow(img_wrap),plt.title('WRAP')
plt.subplot(236),plt.imshow(img_constant),plt.title('CONSTANT')
plt.imshow(img_replicate)
plt.show()